package exploit;
require Exporter;
@ISA = qw(Exporter);
@EXPORT_OK = qw(get_flags);

$cmd='./capture_some_flags_test.pl';

sub get_flags
{
    my @ret;
    my ($ip,$forker)=@_;
    my $gl=$forker->{global_log};
    my $cl=$forker->{custom_log};

    #$gl->info('This is a message to global log');
    #$cl->info('This is a message to custom (this exploit) log');
    #
    #You can also use  debug(), warning(), error(), alert() instead of info()
    #e.f. $gl->alert("ALERT!"); #alert also puts message to STDERR. Admin will see it... May be.

    open F,"$cmd $ip 2>>my_log.txt |" or die "Can`t open pipe : $!\n";
    while(<F>)
    {
	chomp;
	$forker->put_flag($_);
    }
    close F;
    return undef;
    #return \@flags; #You can also return flags in such way (It SHOULD be a ref to array, not array itself), but
		     #this is not a good idea.
		     #$forker->put_flag($flag) is MUCH better!
}
